﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;


namespace Web.group
{
    public partial class sysrole : PageBase
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            SetDivePage(ref GridView1, ref GV);
            if (!IsPostBack)
            {
                QueryData();
            }
        }

        public override void QueryData()
        {
            Hashtable user = PhoneBook.Users.Users.get(Commons.StrUtil.FormatValue(Session["userid"]));
            DataSet ds = PhoneBook.Manage.SysRole.getGroupRole(Commons.StrUtil.FormatValue(user["groupid"]));
            //绑定数据集
            GVDataBind(ref GridView1, ref GV, ds);
        }

        public void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            switch (e.CommandName)
            {
                case "del":
                    string roleid = e.CommandArgument.ToString();
                    Hashtable sysrole = PhoneBook.Manage.SysRole.get(roleid);
                    AddLog("删除了角色：{0}", sysrole["rolename"]);
                    PhoneBook.Manage.SysRole.del(roleid);
                    Helper.ShowMessage(u_message, controls.UCMessageType.success, "删除成功");
                    QueryData();
                    break;
                default:
                    break;
            }
        }
    }
}